package interfaces;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class SeleccionarTienda extends JDialog {

	private final JPanel panelOpciones = new JPanel();
	private JButton btnKiosko;
	private JButton btnBar;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			SeleccionarTienda dialog = new SeleccionarTienda();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
			dialog.setResizable(false);
		    dialog.setLocationRelativeTo(null);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public SeleccionarTienda() {
		setTitle("Seleccionar tienda");
		setBounds(100, 100, 335, 160);
		getContentPane().setLayout(new BorderLayout());
		panelOpciones.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(panelOpciones, BorderLayout.CENTER);
		{
			btnKiosko = new JButton("KIOSKO");
			btnKiosko.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					//ABRIMOS EL JFRAME - PARA KIOSKO
				}
			});
		}
		{
			btnBar = new JButton("BAR");
			btnBar.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					//ABRIR JFRAME - PARA BAR
				}
			});
		}
		GroupLayout gl_panelOpciones = new GroupLayout(panelOpciones);
		gl_panelOpciones.setHorizontalGroup(
			gl_panelOpciones.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panelOpciones.createSequentialGroup()
					.addGap(120)
					.addComponent(btnKiosko))
				.addGroup(Alignment.TRAILING, gl_panelOpciones.createSequentialGroup()
					.addContainerGap(135, Short.MAX_VALUE)
					.addComponent(btnBar)
					.addGap(129))
		);
		gl_panelOpciones.setVerticalGroup(
			gl_panelOpciones.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panelOpciones.createSequentialGroup()
					.addGap(25)
					.addComponent(btnKiosko)
					.addPreferredGap(ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
					.addComponent(btnBar))
		);
		panelOpciones.setLayout(gl_panelOpciones);
		{
			JPanel panelSalida = new JPanel();
			panelSalida.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(panelSalida, BorderLayout.SOUTH);
			{
				JButton btnSalir = new JButton("Salir");
				btnSalir.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseClicked(MouseEvent e) {
						setVisible(false);
						//Si queremos volver a la ventana de usuario
						//new IniciarSesion().setVisible(true);
					}
				});
				btnSalir.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						setVisible(false);
					}
				});
				btnSalir.setActionCommand("Salir");
				panelSalida.add(btnSalir);
			}
		}
	}

}
